package xyz.kail.demo.prometheus.boot.config;

import org.springframework.aop.framework.ProxyFactory;

/**
 * Created by kail on 2018/2/4.
 */
public class Main {

    public void doSomeThing() {
        System.out.println("doSomeThing");
    }

    public static void main(String[] args) {
        ProxyFactory proxyFactory = new ProxyFactory(new Main());
        proxyFactory.addAdvice(new MyBeforeInterceptor());
        proxyFactory.addAdvice(new MyInterceptor());

        Object proxy = proxyFactory.getProxy();
        Main methodInterceptor = (Main) proxy;

        methodInterceptor.doSomeThing();
    }

}
